package likou.tanxin;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2020/11/15 19:11
 */
public class _991 {
    public static void main(String[] args) {
        System.out.println(brokenCalc(2, 3));
    }

    public static int brokenCalc(int X, int Y) {
        int daan = 0;
        while (true) {
            if (X == Y) {
                return daan;
            }
            while ((Y - X) / 2 + (Y - X) % 2 > Math.abs(Y / 2 - X) + Y % 2) {
                X *= 2;
                daan++;
            }
            while ((Y - X) / 2 + (Y - X) % 2 > Math.abs(Y / 2 - X) + Y % 2) {
                X--;
                daan++;
            }
        }
    }
}
